package com.blb.utils;

import org.apache.shiro.SecurityUtils;

import com.blb.entity.User;

public class SessionUtils {

	/**
	 * 获取当前登录的用户ID
	 * @return
	 */
	public static String getUserId(){
		return getUser().getId();
	}
	
	/**
	 * 获取用户名
	 * @return
	 */
	public static String getUserName(){
		return getUser().getUsername();
	}
	
	/**
	 * 获取当前登录用户
	 * @return
	 */
	public static User getUser(){
		return (User) SecurityUtils.getSubject().getPrincipal();
	}
}
